﻿using System.ServiceModel.Dispatcher;

namespace RemoteFacade.ServiceHost
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var host = new System.ServiceModel.ServiceHost(typeof(object)))
            {
                foreach (var cdb in host.ChannelDispatchers)
                {
                    var cd = cdb as ChannelDispatcher;
                    if (cd == null)
                        continue;

                    foreach (var endpoint in cd.Endpoints)
                    {
                        endpoint.DispatchRuntime.InstanceProvider =
                            new InjectedInstanceProvider();
                    }
                }
            }
        }
    }
}
